3.9 \(\int \frac {\sin (x)}{-2+\cos (x)+\cos ^2(x)} \, dx\)

Optimal. Leaf size=21 \[ \frac {1}{3} \log (\cos (x)+2)-\frac {1}{3} \log (1-\cos (x)) \]

[Out]

-1/3*ln(1-cos(x))+1/3*ln(2+cos(x))

________________________________________________________________________________________

Rubi [A]  time = 0.02, antiderivative size = 21, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.231, Rules used = {3259, 616, 31} \[ \frac {1}{3} \log (\cos (x)+2)-\frac {1}{3} \log (1-\cos (x)) \]

Antiderivative was successfully verified.

[In]

Int[Sin[x]/(-2 + Cos[x] + Cos[x]^2),x]

[Out]

-Log[1 - Cos[x]]/3 + Log[2 + Cos[x]]/3

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 616

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> With[{q = Rt[b^2 - 4*a*c, 2]}, Dist[c/q, Int[1/Simp
[b/2 - q/2 + c*x, x], x], x] - Dist[c/q, Int[1/Simp[b/2 + q/2 + c*x, x], x], x]] /; FreeQ[{a, b, c}, x] && NeQ
[b^2 - 4*a*c, 0] && PosQ[b^2 - 4*a*c] && PerfectSquareQ[b^2 - 4*a*c]

Rule 3259

Int[((a_.) + (b_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n_.) + (c_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n2_.))^(p_.)
*sin[(d_.) + (e_.)*(x_)]^(m_.), x_Symbol] :> Module[{g = FreeFactors[Cos[d + e*x], x]}, -Dist[g/e, Subst[Int[(
1 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Cos[d + e*x]/g], x]] /; FreeQ[{a, b, c,
 d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rubi steps

\begin {align*} \int \frac {\sin (x)}{-2+\cos (x)+\cos ^2(x)} \, dx &=-\operatorname {Subst}\left (\int \frac {1}{-2+x+x^2} \, dx,x,\cos (x)\right )\\ &=-\left (\frac {1}{3} \operatorname {Subst}\left (\int \frac {1}{-1+x} \, dx,x,\cos (x)\right )\right )+\frac {1}{3} \operatorname {Subst}\left (\int \frac {1}{2+x} \, dx,x,\cos (x)\right )\\ &=-\frac {1}{3} \log (1-\cos (x))+\frac {1}{3} \log (2+\cos (x))\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 0.03, size = 19, normalized size = 0.90 \[ \frac {1}{3} \left (\log (\cos (x)+2)-2 \log \left (\sin \left (\frac {x}{2}\right )\right )\right ) \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[x]/(-2 + Cos[x] + Cos[x]^2),x]

[Out]

(Log[2 + Cos[x]] - 2*Log[Sin[x/2]])/3

________________________________________________________________________________________

fricas [A]  time = 0.58, size = 17, normalized size = 0.81 \[ \frac {1}{3} \, \log \left (\cos \relax (x) + 2\right ) - \frac {1}{3} \, \log \left (-\frac {1}{2} \, \cos \relax (x) + \frac {1}{2}\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(-2+cos(x)+cos(x)^2),x, algorithm="fricas")

[Out]

1/3*log(cos(x) + 2) - 1/3*log(-1/2*cos(x) + 1/2)

________________________________________________________________________________________

giac [A]  time = 0.30, size = 17, normalized size = 0.81 \[ \frac {1}{3} \, \log \left (\cos \relax (x) + 2\right ) - \frac {1}{3} \, \log \left (-\cos \relax (x) + 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(-2+cos(x)+cos(x)^2),x, algorithm="giac")

[Out]

1/3*log(cos(x) + 2) - 1/3*log(-cos(x) + 1)

________________________________________________________________________________________

maple [A]  time = 0.08, size = 16, normalized size = 0.76 \[ \frac {\ln \left (2+\cos \relax (x )\right )}{3}-\frac {\ln \left (-1+\cos \relax (x )\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)/(-2+cos(x)+cos(x)^2),x)

[Out]

1/3*ln(2+cos(x))-1/3*ln(-1+cos(x))

________________________________________________________________________________________

maxima [A]  time = 0.33, size = 15, normalized size = 0.71 \[ \frac {1}{3} \, \log \left (\cos \relax (x) + 2\right ) - \frac {1}{3} \, \log \left (\cos \relax (x) - 1\right ) \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(-2+cos(x)+cos(x)^2),x, algorithm="maxima")

[Out]

1/3*log(cos(x) + 2) - 1/3*log(cos(x) - 1)

________________________________________________________________________________________

mupad [B]  time = 0.16, size = 9, normalized size = 0.43 \[ \frac {2\,\mathrm {atanh}\left (\frac {2\,\cos \relax (x)}{3}+\frac {1}{3}\right )}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(x)/(cos(x) + cos(x)^2 - 2),x)

[Out]

(2*atanh((2*cos(x))/3 + 1/3))/3

________________________________________________________________________________________

sympy [A]  time = 0.20, size = 15, normalized size = 0.71 \[ - \frac {\log {\left (\cos {\relax (x )} - 1 \right )}}{3} + \frac {\log {\left (\cos {\relax (x )} + 2 \right )}}{3} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(x)/(-2+cos(x)+cos(x)**2),x)

[Out]

-log(cos(x) - 1)/3 + log(cos(x) + 2)/3

________________________________________________________________________________________